package com.snopy.designPattern.observer.impl;

import com.snopy.designPattern.observer.EventListener;
import lombok.extern.slf4j.Slf4j;

import java.io.File;

/**
 * @author snopy
 * @version 1.0.0
 * @classname LogOpenListener
 * @description
 * @email 77912204@qq.com
 * @date 2022/03/16 16:30
 */
public class LogOpenListener implements EventListener {
    private File log;

    public LogOpenListener(String fileName) {
        this.log = new File(fileName);
    }

    @Override
    public void update(String eventType, File file) {
        System.out.println("Save to log " + log + ": Someone has performed " + eventType + " operation with the following file: " + file.getName());
    }
}
